from Utils.gy_kl_api.door_data import door_data
from Utils.router import router


@router.get("/gy/door_insum&percent", tags=['移动端定制数据'], summary="任意时间段客流点位、进客流、占比")
async def door_data_ctx(start_date: str = None, end_date: str = None, limit: int = None, page: int = None):
    data = door_data(start_date, end_date)
    num = limit * page
    if start_date and end_date != 0:
        try:
            return {'code': 0, "count": data[1], "data": data[0]}
        except():
            return {'code': 0, "count": data[1], "data": [], 'msg': '获取数据失败'}
    else:
        return {'code': 0, "count": 0, "data": [], 'msg': '未执行查询'}
